package com.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.UserDao;
import com.hibernate.pojo.User;
import com.tool.CreateID;

@Service("userService")
public class UserServcie {
	
	@Resource(name="UserDao")
	private UserDao userDao;
	
	@Resource(name="CreateID")
	private CreateID createID;
	
	@Resource(name="User")
	private User user;
	public boolean login(String name,String pwd){
		System.out.println(name+"|"+pwd);
		return userDao.login(name, pwd);
	}
	
	public boolean register(String name,String pwd){
		int id = createID.id();
		user.setId(id);
		user.setName(name);
		user.setPwd(pwd);
		return userDao.register(user);
	}
	
	public String getUserIdByName(String name){
		return userDao.getuseridbyname(name);
	}
}
